import { useResponseSuccess } from '~/utils/response';

export default eventHandler((event) => {
  const query = getQuery(event);
  const contextId = query.contextId as string;

  const serviceItems = [
    // 温泉洗浴服务
    {
      id: '1',
      name: '温泉泡浴',
      description: '天然温泉泡浴，放松身心',
      price: 88,
      duration: 60,
      contextId: '1',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
    {
      id: '2',
      name: '全身按摩',
      description: '专业技师全身按摩服务',
      price: 128,
      duration: 90,
      contextId: '1',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
    {
      id: '3',
      name: 'SPA护理',
      description: '精油SPA护理服务',
      price: 168,
      duration: 120,
      contextId: '1',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
    // 酒店公寓服务
    {
      id: '4',
      name: '标准间',
      description: '舒适标准间住宿',
      price: 299,
      duration: 1440, // 24小时
      contextId: '2',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
    {
      id: '5',
      name: '豪华套房',
      description: '豪华套房住宿',
      price: 599,
      duration: 1440,
      contextId: '2',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
    // 餐厅服务
    {
      id: '6',
      name: '中餐包间',
      description: '中式餐厅包间预订',
      price: 0,
      duration: 120,
      contextId: '3',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
    {
      id: '7',
      name: '西餐包间',
      description: '西式餐厅包间预订',
      price: 0,
      duration: 120,
      contextId: '3',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
    // 宠物医疗服务
    {
      id: '8',
      name: '宠物体检',
      description: '宠物健康体检服务',
      price: 150,
      duration: 30,
      contextId: '4',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
    {
      id: '9',
      name: '疫苗接种',
      description: '宠物疫苗接种服务',
      price: 80,
      duration: 20,
      contextId: '4',
      status: 1,
      createTime: '2024-01-01 00:00:00',
      updateTime: '2024-01-01 00:00:00',
    },
  ];

  // 如果指定了contextId，则过滤对应业务场景的服务
  const filteredItems = contextId
    ? serviceItems.filter((item) => item.contextId === contextId)
    : serviceItems;

  return useResponseSuccess(filteredItems);
});
